package start;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;

public class MyNameGenerator implements BeanNameGenerator {
    public MyNameGenerator() {
        System.out.println("Create " + this);
    }
    @Override
    public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
        String result="noname";   
        System.out.println(definition.getBeanClassName());
        if (definition.getBeanClassName()=="start.A") {
            result="aBean";
        } else result="bBean";
        System.out.println("generateBeanName ("+definition+","+registry+")="+result);
        return result;
    }
}
